//
//  MineNavigatorMap.swift
//  Pods
//
//  Created by eme on 2017/3/27.
//
//

import UIKit
import URLNavigator
import UtilCore
import RxSwift
import RxCocoa
import RickonCore

public struct MineNavigatorMap{

    static let disposeBag = DisposeBag()
    
   public static func initialize(){
        
        Navigator.map("/setup"){url,values in
            let setup_Vc:SetupVc = SansaCore.storyboard.instantiateViewController()
            Navigator.push(setup_Vc)
            return true
                
        }
        Navigator.map("/dpxx"){url,values in
            let dpxxVc:DPXX_Vc = SansaCore.storyboard.instantiateViewController()
            Navigator.push(dpxxVc)
            return true
        }
        Navigator.map("/order"){url,values in
            let OrderVc:BaseOrderVc = BaseOrderVc()
            OrderVc.hidesBottomBarWhenPushed = true
            OrderVc.Orderindex = Int(url.queryParameters["index"]!)
            Navigator.push(OrderVc)
            return true
        }
        Navigator.map("/logistics"){url,values in
            let Logistics:LogisticsVc = SansaCore.storyboard.instantiateViewController()
            Logistics.orderid = url.queryParameters["orderid"]
            Navigator.push(Logistics)
            return true
        }
        Navigator.map("/collect_vc"){url,values in
            let Collect_Vc:Collect_Vc = SansaCore.storyboard.instantiateViewController()
            Collect_Vc.isPush = true
            Navigator.push(Collect_Vc)
            return true
        }
        Navigator.map("/footer"){url,values in
            let FootPrintvc:FootPrintVc = SansaCore.storyboard.instantiateViewController()
            Navigator.push(FootPrintvc)
            return true
        }
        //--
        Navigator.map("/Category_Vc"){url,values in
            let FootPrintvc:Category_Vc = SansaCore.storyboard.instantiateViewController()
            Navigator.push(FootPrintvc)
            return true
        }
    //--
        Navigator.map("/order_detail"){url,values in
            let orderdetaile:MyOrderDetailsViewController = SansaCore.storyboard.instantiateViewController()
            orderdetaile.orderID = url.queryParameters["id"]
            Navigator.push(orderdetaile)
            return true
        }
        ///查看组合商品列表
        Navigator.map("/OrderGroup"){url,values in
            let OrderGroup:CombinationGoodsVc = SansaCore.storyboard.instantiateViewController()
            OrderGroup.orderId = url.queryParameters["orderid"]
            OrderGroup.pdid = url.queryParameters["pdid"]
            Navigator.push(OrderGroup)
            return true
        }
        //修改店铺信息
        Navigator.map("/changedpmessage"){url,values in
            let changeDp:ChangeDPMessageVc = SansaCore.storyboard.instantiateViewController()
            changeDp.customTitle = url.queryParameters["title"]
            changeDp.spname = url.queryParameters["spname"]
            changeDp.address = url.queryParameters["address"]
            changeDp.spcontact = url.queryParameters["spcontact"]
            Navigator.push(changeDp)
            return true
        }
        //企业信息
        Navigator.map("/qy_message"){ url,values in
            let qyMessage:QYZL_Vc = SansaCore.storyboard.instantiateViewController()
            qyMessage.qy_name = url.queryParameters["name"]!
            qyMessage.yyzz_id = url.queryParameters["yyzz"]!
            qyMessage.yyzz_url = url.queryParameters["url"]!
            Navigator.push(qyMessage)
            return true
        }
        //账户安全
        Navigator.map("/accountsecurity"){ url,values in
            let security:ZHAQ_Vc = SansaCore.storyboard.instantiateViewController()
            Navigator.push(security)
            return true
        }
        //验证手机
        Navigator.map("/changephone"){url,values in
            let changePhone:ChangePhoneVc = SansaCore.storyboard.instantiateViewController()
            changePhone.changeMessage = url.queryParameters["changeMessage"]!
            changePhone.phone = url.queryParameters["phone"]!
            Navigator.push(changePhone)
            return true
        }
        //绑定新手机
        Navigator.map("/buildnewphone"){url,values in
            let buildNewPhone:BuildNewPhoneVc = SansaCore.storyboard.instantiateViewController()
            Navigator.push(buildNewPhone)
            return true
        }
        //关于觅客
        Navigator.map("/aboutmiker"){ url,values in
            let about:AboutMikerVc = SansaCore.storyboard.instantiateViewController()
            Navigator.push(about)
            return true
        }
        //反馈
        Navigator.map("/feedbackVc"){url,values in
            let feedbackVc:FeedbackVc = SansaCore.storyboard.instantiateViewController()
            Navigator.push(feedbackVc)
            return true
        }
        ///跳转评价界面
        Navigator.map("/evaluation"){url,values in
            let Evaluation:EvaluationVc = SansaCore.storyboard.instantiateViewController()
            Evaluation.orderID = url.queryParameters["orderid"]
            Navigator.push(Evaluation)
            return true
        }
        ///跳转投诉界面
        Navigator.map("/complaints"){url,values in
            let Complaints:ComplaintsViewController = SansaCore.storyboard.instantiateViewController()
            Complaints.detailid = url.queryParameters["detailid"]
            Navigator.push(Complaints)
            return true
        }
        Navigator.map("/message"){url,values in
            let message:BaseMessageVc = BaseMessageVc()
            message.hidesBottomBarWhenPushed = true
            Navigator.push(message)
            return true
        }
        ///跳转到意见反馈
        Navigator.map("/feedback") { URL, values in
            //==
            let Message_FeedBack:Message_FeedBackVc = SansaCore.storyboard.instantiateViewController()
            Message_FeedBack.feedBackId = URL.queryParameters["id"]
            Navigator.push(Message_FeedBack)
            //==
            return true
        }
        ///跳转到投诉界面
        Navigator.map("/complain") { URL, values in
            let Message_DetaileVc:Message_DetaileVc_Complain = SansaCore.storyboard.instantiateViewController()
            Message_DetaileVc.requestID = URL.queryParameters["id"]
            Navigator.push(Message_DetaileVc)
            return true
        }
        ///跳转到品牌库
        Navigator.map("/brandlibrary") { URL, values in
            let Message_DetaileVc:BrandLibraryVc = SansaCore.storyboard.instantiateViewController()
            Navigator.push(Message_DetaileVc)
            return true
        }
        Navigator.map("/storemessage") { URL, values in
            let Message_DetaileVc:DPXX_Vc = SansaCore.storyboard.instantiateViewController()
            Navigator.push(Message_DetaileVc)
            return true
        }
        ///跳转订单退款详情
        Navigator.map("/refundDetailsVc") { URL, values in
            let refundDetailsVc:RefundDetailsVc = SansaCore.storyboard.instantiateViewController()
            refundDetailsVc.deteilID = URL.queryParameters["id"]
            Navigator.push(refundDetailsVc)
            return true
        }


        Navigator.map("/messagenum"){url,values in
    //            let _:MineVc = SansaCore.storyboard.instantiateViewController()
            Observable.just()
                .map{MineApi.getMessageCount()}
                .emeRequestApiForObj(OrderNumModel.self)
                .subscribe(onNext: { (result) in
                switch result{
                case .success(let data):
                    NotificationCenter.default.post(name: NSNotification.Name(rawValue: AppConfig.notification.messagenumKey), object: data.messagenum, userInfo: nil)
                case .failure(_):
                    break
                }
            }).addDisposableTo(disposeBag)
            return true
        }
        Navigator.map("/ptflPage"){ URL,values in
            let refundDetailsVc:Category_Vc_goods = SansaCore.storyboard.instantiateViewController()
            refundDetailsVc.customtitle = URL.queryParameters["title"]
            refundDetailsVc.pptype = URL.queryParameters["pptype"]
            refundDetailsVc.pptid = URL.queryParameters["pptid"]
            Navigator.push(refundDetailsVc)
            return true
            
        }
        ///认证信息
    //    RZViewController/
        Navigator.map("/certification") { URL, values in
            let refundDetailsVc:RZViewController = SansaCore.storyboard.instantiateViewController()
            refundDetailsVc.detailid = URL.queryParameters["id"]
            Navigator.push(refundDetailsVc)
            return true
        }
    }
}
